package com.nbsaas.boot.order.rest.resource;

import com.nbsaas.boot.order.api.apis.OrderInvoiceApi;
import com.nbsaas.boot.order.data.entity.OrderInvoice;
import com.nbsaas.boot.order.api.domain.request.OrderInvoiceRequest;
import com.nbsaas.boot.order.api.domain.response.OrderInvoiceResponse;
import com.nbsaas.boot.order.api.domain.simple.OrderInvoiceSimple;
import com.nbsaas.boot.order.rest.convert.OrderInvoiceSimpleConvert;
import com.nbsaas.boot.order.rest.convert.OrderInvoiceEntityConvert;
import com.nbsaas.boot.order.rest.convert.OrderInvoiceResponseConvert;
import com.nbsaas.boot.order.data.repository.OrderInvoiceRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   -业务接口实现
*/
@Transactional
@Service
public class OrderInvoiceResource extends BaseResource<OrderInvoice,OrderInvoiceResponse, OrderInvoiceSimple, OrderInvoiceRequest>  implements OrderInvoiceApi {

    @Resource
    private OrderInvoiceRepository orderInvoiceRepository;

    @Override
    public JpaRepositoryImplementation<OrderInvoice, Serializable> getJpaRepository() {
        return orderInvoiceRepository;
    }

    @Override
    public Function<OrderInvoice, OrderInvoiceSimple> getConvertSimple() {
        return new OrderInvoiceSimpleConvert();
    }

    @Override
    public Function<OrderInvoiceRequest, OrderInvoice> getConvertForm() {
        return new OrderInvoiceEntityConvert();
    }

    @Override
    public Function<OrderInvoice, OrderInvoiceResponse> getConvertResponse() {
        return new OrderInvoiceResponseConvert();
    }




}


